<?php

App::uses('AppController', 'Controller');

class IndexController extends AppController {

    public function beforeFilter() {
        $this->Auth->allow();
        parent::beforeFilter();
    }

    public function index() {
        $this->request->allowMethod('get');
        if ($this->Auth->login())
        {
            $user = $this->Auth->user();
            $this->loadModel('Category');
            $category = $this->Category->getById($user['category_id']);
            $this->redirect(array('controller'=>$category['Category']['controller'], 'action'=>$category['Category']['action']), null, true);
            return;
        }
        $this->set('title', 'Entrena<span class="kaushan">Te!</span>');
        $this->layout = 'base';
    }

}
